workspace "FysicsAR"
    architecture "x64"
    startproject "VirtualMachine"

    configurations
    {
        "Debug",
        "Release",
        "Dist"
    }

    defines
    {
        "FAR_IMPLEMENT_OPENGL"
    }

outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"

IncludeDir = {}
IncludeDir["GLFW"] = "VirtualMachine/libraries/GLFW/include"
IncludeDir["GLAD"] = "VirtualMachine/libraries/glad/include"
IncludeDir["glm"] = "VirtualMachine/libraries/glm"
IncludeDir["assimp"] = "VirtualMachine/libraries/assimp/include"
IncludeDir["stbi"] = "VirtualMachine/libraries/stb_image/include"
IncludeDir["freetype"] = "VirtualMachine/libraries/freetype/include"
IncludeDir["Wit"] = "VirtualMachine/libraries/Wit/include"


include "VirtualMachine/libraries/GLFW"
include "VirtualMachine/libraries/GLAD"
include "VirtualMachine/libraries/Wit"

-- Virtual Machine ------------------------------------------------------

project "VirtualMachine"
    location "VirtualMachine"
    kind "ConsoleApp"
    language "C++"
    cppdialect "C++17"
    staticruntime "on"

    targetdir ("bin/" .. outputdir .. "/%{prj.name}")
    objdir ("bin-int/" .. outputdir .. "/%{prj.name}")

    files 
    {
        "%{prj.name}/src/**.h",
		"%{prj.name}/src/**.cpp",
        "%{IncludeDir.glm}/glm/**.hpp",
        "%{IncludeDir.glm}/glm/**.inl",
        "%{IncludeDir.stbi}/stb_image/**.h",
        "%{IncludeDir.stbi}/stb_image/**.cpp",
        "%{IncludeDir.Wit}/Wit/**.h",
        "%{IncludeDir.Wit}/Wit/**.c",
        "%{IncludeDir.Wit}/Wit/**.cpp"
    }

    includedirs
    {
        "%{prj.name}/src",
        "%{IncludeDir.GLFW}",
        "%{IncludeDir.GLAD}",
        "%{IncludeDir.glm}",
		"%{IncludeDir.assimp}",
        "%{IncludeDir.stbi}",
		"%{IncludeDir.freetype}",
		"%{IncludeDir.Wit}",
        "Softwares/src"
    }

	libdirs
	{
		"VirtualMachine/libraries/assimp/build/lib/Debug",
		"VirtualMachine/libraries/freetype/lib"
	}

    links
    {
        "Softwares",
        "GLFW",
        "GLAD",
		"assimp-vc143-mtd.lib",
        "opengl32.lib",
		"freetype.lib",
        "Wit"
    }

    filter "system:windows"
        staticruntime "on"
        systemversion "latest"
        defines 
        {
            "GLFW_INCLUDE_NONE",
            "FAR_PLATFORM_WINDOWS"
        }

    filter "configurations:Debug"
        defines "FAR_DEBUG"
        symbols "on"
        runtime "Debug"
        buildoptions "/MDd"
        defines
        {
            "FAR_LIFETIME_DEVELOPING",  -- 还在开发阶段必须要做测试
            "FAR_ENABLE_KEYMOUSE_DEBUGING"   -- 允许用键鼠来进行调试
        }

    filter "configurations:Release"
		defines "FAR_RELEASE"
		optimize "on"
        runtime "Release"
		buildoptions "/MD"
        defines
        {
            "FAR_LIFETIME_RELEASE",
            "FAR_ENABLE_KEYMOUSE_DEBUGING"
        }

	filter "configurations:Dist"
		defines "FAR_DIST"
		optimize "on"
        runtime "Release"
		buildoptions "/MD"


-- Softwares -----------------------------------------------------------

project "Softwares"
    location "Softwares"
    kind "StaticLib"
    language "C++"
    cppdialect "C++17"
    staticruntime "on"

    targetdir ("bin/" .. outputdir .. "/%{prj.name}")
    objdir ("bin-int/" .. outputdir .. "/%{prj.name}")

    files
    {
        "%{prj.name}/src/**.h",
		"%{prj.name}/src/**.cpp",     
    }

    includedirs
    {
        "VirtualMachine/src",
        "%{IncludeDir.glm}",
		"%{IncludeDir.assimp}",
		"%{IncludeDir.freetype}"
    }

    links
    {
        
    }

    filter "system:windows"
        staticruntime "on"
        systemversion "latest"
        defines 
        {
            "FAR_PLATFORM_WINDOWS"
        }

    filter "configurations:Debug"
        defines "FAR_DEBUG"
        symbols "on"
        runtime "Debug"
        buildoptions "/MDd"

    filter "configurations:Release"
		defines "FAR_RELEASE"
		optimize "on"
        runtime "Release"
		buildoptions "/MD"

	filter "configurations:Dist"
		defines "FAR_DIST"
		optimize "on"
        runtime "Release"
		buildoptions "/MD"